package com.apptravel.dao;

import com.apptravel.entity.AirLineComp;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component("airLineCompDao")
public class AirLineCompDAOImpl extends MybatisDao implements AirLineCompDAO {

    public AirLineCompDAOImpl() {
        super();
    }

    /**
     * 删除
     * @param id
     * @return
     */
    public int delete(Long id) {
        AirLineComp _key = new AirLineComp();
        _key.setId(id);
        int rows = getSqlSession().delete("airlinecomp.deleteById", _key);
        return rows;
    }

    /**
     * 按MAP删除.
     *
     * @param params
     * @return
     */
    public int deleteByMap(Map<String,Object> params){
        return this.getSqlSession().delete("airlinecomp.deleteByMap",params);
    }

    /**
     * 保存
     * @param record
     */
    public void insert(AirLineComp record) {
        getSqlSession().insert("airlinecomp.insert", record);
    }

    /**
     * 查找单例.
     *
     * @param id
     * @return
     */
    public AirLineComp selectById(Long id) {
        AirLineComp _key = new AirLineComp();
        _key.setId(id);
        AirLineComp record = (AirLineComp) getSqlSession().selectOne("airlinecomp.selectById", _key);
        return record;
    }

    /**
     * 更新.
     * @param record
     * @return
     */
    public int updateById(AirLineComp record) {
        int rows = getSqlSession().update("airlinecomp.updateById", record);
        return rows;
    }

    /**
     * 分页列表.                  
     *
     * @param params
     * @param pageNo
     * @param pageSize
     * @return
     */
    public Page<AirLineComp> getList(Map<String,Object> params,int pageNo,int pageSize){
        params.put("page","");
        return this.selectPage("airlinecomp.selectByMap",params,pageNo,pageSize);
    }


}